#include "cdefaultstyles.h"

/**
 * CDefaultStyles - constructor, creates styles map
 * @param styles
 */
CDefaultStyles::CDefaultStyles(const map<int, map<int, CGuiStyle> > &styles) {
  this->styles = styles;
}
//---------------------------------------------------------------------------

/**
 * find - finds style for given state of component
 * @param componentId
 * @param styleId
 * @param style
 * @return true/false style was/was not found
 */
bool CDefaultStyles::find(int componentId, int styleId, CGuiStyle &style) {

  // Finds component
  map<int, map<int, CGuiStyle> >::iterator i = styles.find(componentId);
  if (i == styles.end()) return false;

  // Finds style type
  map<int, CGuiStyle>::iterator j = i->second.find(styleId);
  if (j == i->second.end()) return false;

  // Applies selected style
  style = j->second;
  return true;
}
//---------------------------------------------------------------------------
